<?php
//Khong hien thi thong bao loi he thong
ini_set("display_errors","0");

//Cau hinh chung
$mlpConfig_dbhost = 'localhost';
$mlpConfig_username = 'root';
$mlpConfig_password = '';
$mlpConfig_dbname = 'quanlydaotao';
$mlpConfig_sitenameVI = '';
$mlpConfig_sitenameEN = '';
$mlpConfig_adminsitenameVI = '';
$mlpConfig_adminsitenameEN = '';
$mlpConfig_mailhost = 'webmail.ctec.edu.vn';
$mlpConfig_mailfrom = 'dtahuy@ctec.edu.vn';
$mlpConfig_fromname = '';
$mlpConfig_companynameVI = '';
$mlpConfig_companynameEN = '';
$mlpConfig_companyaddressVI = '';
$mlpConfig_companyaddressEN = '';
$mlpConfig_companytelephone = '';
$mlpConfig_companyfax = '';
$mlpConfig_website = '';
$mlpConfig_lang = 'EN';   // Ngon ngu mac dinh phia quan tri website
$mlpConfig_Clang = 'EN';  // Ngon ngu mac dinh phia Client
$mlpConfig_activityimage = 'upload/hoatdong/'; // Thu muc chua cac hinh anh hoat dong
$mlpConfig_productimage = 'upload/products/'; // Thu muc chua hinh cac san pham
$mlpConfig_productthumb = 'upload/products/thumb/'; // Thu muc chua hinh cac san pham dang thumbnail
$mlpConfig_popupimage = 'upload/popup/'; // Thu muc chua cac popup
$mlpConfig_thumbsize = 157; // kich thuoc maximum cua anh thumnail
$mlpConfig_largesize = 500; // kich thuoc maximum cua anh
$mlpConfig_activitysize = 150; //kich thuoc maximum cua hinh anh hoat dong
$video_folder = "upload/video/";
$gallery_folder = "upload/picture/";
$gallery_folder_thumb = "upload/picture/thumb/";
$gallery_fullsize = 800;
$gallery_thumbsize = 120;
foreach ($_GET as $check_url) {
if ((eregi("<[^>]*script*\"?[^>]*>", $check_url)) || (eregi("<[^>]*object*\"?[^>]*>", $check_url)) ||
(eregi("<[^>]*iframe*\"?[^>]*>", $check_url)) || (eregi("<[^>]*applet*\"?[^>]*>", $check_url)) ||
(eregi("<[^>]*meta*\"?[^>]*>", $check_url)) || (eregi("<[^>]*style*\"?[^>]*>", $check_url)) ||
(eregi("<[^>]*form*\"?[^>]*>", $check_url)) || (eregi("\([^>]*\"?[^)]*\)", $check_url)) ||
(eregi("\"", $check_url)) || (eregi("\'", $check_url))) {
die ('<p style="text-align:center; color:red">B&#7841;n nh&#7853;p v&#224;o th&#244;ng tin kh&#244;ng h&#7907;p l&#7879;!<br><a href="javascript:history.back(1);">Tr&#7903; v&#7873;</a>&nbsp;-&nbsp;<a href="index.php">Trang ch&#7911;</a></p>');
}
}

function replaceString($st){
    $temp = $st;
    $temp = str_replace("\'","mNhayDon",$temp);
    $temp = str_replace('\\"','mNhayDoi',$temp);
    $temp = str_replace('>','mNgoacLon',$temp);
    $temp = str_replace('<','mNgoacNho',$temp);
    $temp = str_replace("-","mTru",$temp);
    return $temp;
}
function unReplaceString($st){
    $temp = $st;
    $temp = str_replace("mNhayDon","'",$temp);
    $temp = str_replace('mNhayDoi','&quot;',$temp);
    $temp = str_replace('mNgoacLon','&gt;',$temp);
    $temp = str_replace('mNgoacNho','&lt;',$temp);
    $temp = str_replace("mTru","-",$temp);
    return $temp;
}
function replace($st)
	{
		$temp = $st;
		$temp = str_replace("'","&#8217;",$temp);
		$temp = str_replace('>','mNgoacLon',$temp);
		$temp = str_replace('<','mNgoacNho',$temp);
		$temp = str_replace('"','mNhayDoi',$temp);
		//$temp = str_replace("&nbsp;"," ",$temp);
		return $temp;
	}
	function unReplace($st)
	{
		
		$temp = $st;
		$temp = str_replace("&#8217;","'",$temp);
		$temp = str_replace('mNgoacLon','&gt;',$temp);
		$temp = str_replace('mNgoacNho','&lt;',$temp);
		$temp = str_replace('mNhayDoi','&quot;',$temp);
	//	$temp = str_replace(" ","&nbsp;",$temp);
		return $temp;
	}
	
	function replaceFCK($st)
	{
		$temp = $st;
		$temp = str_replace("'","&#8217;",$temp);
		return $temp;
	}
	function unReplaceFCK($st)
	{
		$temp = $st;
		$temp = str_replace("&#8217;","'",$temp);
		return $temp;
	}

$connect = mysql_connect($mlpConfig_dbhost,$mlpConfig_username,$mlpConfig_password)
 or die("Kh&#244;ng th&#7875; k&#7871;t n&#7889;i &#273;&#7871;n c&#417; s&#7903; d&#7919; li&#7879;u");
 mysql_query("SET NAMES 'utf8'",$connect);
mysql_select_db($mlpConfig_dbname,$connect);


